package com.fengye.swagger3.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author sky
 * @version 1.0
 * @since 2021/4/10 23:56
 */

@Configuration
@EnableOpenApi // swagger3
public class Swagger3Configuration {

    @Bean
    public Docket multipartApi(){
        return new Docket(DocumentationType.OAS_30)
                .groupName("swagger3 group")
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }

    public ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Swagger3 API") // 标题
                .description("restful api testing.") // 描述
                .contact(new Contact("fengye", "https://www.fengye2020.xyz", "fengyexjtu@126.com"))
                .version("1.0")
                .build();
    }

}
